import { IsString, IsNumber, IsOptional, IsDateString } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateTodoDto {
  @ApiProperty({
    description: '任务标题',
    example: '完成项目文档',
  })
  @IsString()
  title: string;

  @ApiPropertyOptional({
    description: '创建人ID（不传则自动使用当前登录用户）',
    example: 1,
  })
  @IsOptional()
  @IsNumber()
  creatorId?: number;

  @ApiPropertyOptional({
    description: '负责人ID（不传则自动设置为创建人）',
    example: 1,
  })
  @IsOptional()
  @IsNumber()
  assigneeId?: number;

  @ApiPropertyOptional({
    description: '父任务ID（创建子任务时需要传递）',
    example: 1,
  })
  @IsOptional()
  @IsNumber()
  parentId?: number;

  @ApiPropertyOptional({
    description: '团队ID（将任务关联到团队）',
    example: 1,
  })
  @IsOptional()
  @IsNumber()
  teamId?: number;

  @ApiPropertyOptional({
    description: '预计完成时间',
    example: '2024-12-31T23:59:59.000Z',
  })
  @IsOptional()
  @IsDateString()
  dueDate?: string;
}
